/* adw.t   ADDRESS MASTER WRITE TRIGGER                               */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :adw.t                                                   */
/*  Author  :Ben Holmes                                              */
/*  Date    :12/4/95                                                 */
/*  !Description : ad_mstr WRITE trigger program                     */
/*          : everytime a record is changed.  It will create a       */
/*          : worktable and then call another program                */
/*          : In order to enhance this trigger to support additional */
/*          : interfaces, add a DO-END block similar to the one      */
/*          : used for the Warehousing Interface to (1) check for the*/
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.5          Last Modified:  12/04/95 BY: BHolmes *J0FY*  */
/*Revision 8.5          Last Modified:  07/27/96 BY: fwy     *J12B*  */
/*Revision 8.5          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/11/00 BY: *N0KK* jyn       */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF AD_MSTR OLD BUFFER OLD_AD_MSTR.

/*J12B  if not can-find(first whl_mstr where whl_mstr.whl_act no-lock) */
/*J12B  then leave. */

    {mfdeclre.i }
    define new shared work-table wf_old_ad_mstr like ad_mstr.
    define new shared variable w-recid as recid.
    define new shared variable w-file-type as character.
    define new shared variable w-site-loc-id like whl_mstr.whl_src_dest_id.

    define variable w-file as character format "x(24)".


    /* Warehousing Interface processing */

    WI:
    do:

    /* If there is no active external warehouse that is flagged to
    receive customer or supplier export tranasctions, then do not process */
/*J12B*/    if not can-find(first whl_mstr no-lock
/*J12B*/        where whl_mstr.whl_act
/*J12B*/          and (whl_mstr.whl_cust_exp or whl_mstr.whl_sup_exp))
/*J12B*/    then leave WI.

    /* If this is a new address, then do not process because the ls_mstr
    WRITE trigger will create the export transactions */
/*J12B*/    if old_ad_mstr.ad_addr = "" then leave WI.

    /* If no pertinent fields have been changed, then do not process */
/*J12B*/    if   (old_ad_mstr.ad_addr    = ad_mstr.ad_addr
/*J12B*/      and old_ad_mstr.ad_name    = ad_mstr.ad_name
/*J12B*/      and old_ad_mstr.ad_line1   = ad_mstr.ad_line1
/*J12B*/      and old_ad_mstr.ad_line2   = ad_mstr.ad_line2
/*J12B*/      and old_ad_mstr.ad_line3   = ad_mstr.ad_line3
/*J12B*/      and old_ad_mstr.ad_city    = ad_mstr.ad_city
/*J12B*/      and old_ad_mstr.ad_state   = ad_mstr.ad_state
/*J12B*/      and old_ad_mstr.ad_zip     = ad_mstr.ad_zip
/*J12B*/      and old_ad_mstr.ad_country = ad_mstr.ad_country
/*J12B*/      and old_ad_mstr.ad_ctry    = ad_mstr.ad_ctry
/*J12B*/      and old_ad_mstr.ad_phone   = ad_mstr.ad_phone
/*J12B*/      and old_ad_mstr.ad_phone2  = ad_mstr.ad_phone2
/*J12B*/      and old_ad_mstr.ad_fax     = ad_mstr.ad_fax
/*J12B*/      and old_ad_mstr.ad_fax2    = ad_mstr.ad_fax2
/*J12B*/      and old_ad_mstr.ad_attn    = ad_mstr.ad_attn
/*J12B*/      and old_ad_mstr.ad_attn2   = ad_mstr.ad_attn2
/*J12B*/      and old_ad_mstr.ad_user1   = ad_mstr.ad_user1
/*J12B*/      and old_ad_mstr.ad_user2   = ad_mstr.ad_user2
/*J12B*/      and old_ad_mstr.ad_type    = ad_mstr.ad_type)
/*J12B*/    then leave WI.

    /* Move old ad_mstr values to work table for subsequent processing */
        assign w-recid = recid(ad_mstr).
        create wf_old_ad_mstr.
        if recid(wf_old_ad_mstr)= -1 then .
        assign
            wf_old_ad_mstr.ad_addr      = old_ad_mstr.ad_addr
            wf_old_ad_mstr.ad_name      = old_ad_mstr.ad_name
            wf_old_ad_mstr.ad_line1     = old_ad_mstr.ad_line1
            wf_old_ad_mstr.ad_line2     = old_ad_mstr.ad_line2
            wf_old_ad_mstr.ad_line3     = old_ad_mstr.ad_line3
            wf_old_ad_mstr.ad_city      = old_ad_mstr.ad_city
            wf_old_ad_mstr.ad_state     = old_ad_mstr.ad_state
            wf_old_ad_mstr.ad_zip       = old_ad_mstr.ad_zip
            wf_old_ad_mstr.ad_country   = old_ad_mstr.ad_country
            wf_old_ad_mstr.ad_ctry      = old_ad_mstr.ad_ctry
            wf_old_ad_mstr.ad_phone     = old_ad_mstr.ad_phone
            wf_old_ad_mstr.ad_phone2    = old_ad_mstr.ad_phone2
            wf_old_ad_mstr.ad_fax       = old_ad_mstr.ad_fax
            wf_old_ad_mstr.ad_fax2      = old_ad_mstr.ad_fax2
            wf_old_ad_mstr.ad_attn      = old_ad_mstr.ad_attn
            wf_old_ad_mstr.ad_attn2     = old_ad_mstr.ad_attn2
            wf_old_ad_mstr.ad_user1     = old_ad_mstr.ad_user1
            wf_old_ad_mstr.ad_user2     = old_ad_mstr.ad_user2
            wf_old_ad_mstr.ad_type      = old_ad_mstr.ad_type
        .

    /* Call subprogram to create export transactions for warehouses */
        w-file = "wiadw.p".
/*J1DM*/ /* {gprun.i ""wiadw.p""} */
/*J1DM*/    {gprunmo.i &module="WI"
                       &program="wiadw.p"}

/*J12B*/end. /* WI */

/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "ad_mstr" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(ad_mstr), input "ad_mstr").

    if not can-find ( first dt_mstr where dt_table = "ad_mstr" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_ad_mstr ) then do:
        create wf_old_ad_mstr.
        if recid(wf_old_ad_mstr)= -1 then .
    end.
    
    buffer-copy old_ad_mstr to wf_old_ad_mstr no-error.

    for each dt_mstr no-lock where dt_table = "ad_mstr" and dt_type = "MOD" :
        
        case dt_field :

            when "ad_addr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_addr, input ad_mstr.ad_addr,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_name" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_name, input ad_mstr.ad_name,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_line1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_line1, input ad_mstr.ad_line1,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_line2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_line2, input ad_mstr.ad_line2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_city" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_city, input ad_mstr.ad_city,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_state" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_state, input ad_mstr.ad_state,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_zip" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_zip, input ad_mstr.ad_zip,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_type, input ad_mstr.ad_type,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_attn" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_attn, input ad_mstr.ad_attn,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_phone" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_phone, input ad_mstr.ad_phone,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_ext" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_ext, input ad_mstr.ad_ext,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_ref, input ad_mstr.ad_ref,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_sort" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_sort, input ad_mstr.ad_sort,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_country" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_country, input ad_mstr.ad_country,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_attn2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_attn2, input ad_mstr.ad_attn2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_phone2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_phone2, input ad_mstr.ad_phone2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_ext2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_ext2, input ad_mstr.ad_ext2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_fax" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_fax, input ad_mstr.ad_fax,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_fax2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_fax2, input ad_mstr.ad_fax2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_line3" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_line3, input ad_mstr.ad_line3,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_user1, input ad_mstr.ad_user1,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_user2, input ad_mstr.ad_user2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_lang" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_lang, input ad_mstr.ad_lang,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_pst_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_pst_id, input ad_mstr.ad_pst_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_date), input string(ad_mstr.ad_date),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_county" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_county, input ad_mstr.ad_county,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_temp" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_temp), input string(ad_mstr.ad_temp),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_bk_acct1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_bk_acct1, input ad_mstr.ad_bk_acct1,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_bk_acct2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_bk_acct2, input ad_mstr.ad_bk_acct2,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_format" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_format), input string(ad_mstr.ad_format),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_vat_reg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_vat_reg, input ad_mstr.ad_vat_reg,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_coc_reg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_coc_reg, input ad_mstr.ad_coc_reg,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_gst_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_gst_id, input ad_mstr.ad_gst_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tax_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_tax_type, input ad_mstr.ad_tax_type,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_taxc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_taxc, input ad_mstr.ad_taxc,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_taxable" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_taxable), input string(ad_mstr.ad_taxable),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tax_in" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_tax_in), input string(ad_mstr.ad_tax_in),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_edi_tpid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_edi_tpid, input ad_mstr.ad_edi_tpid,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_timezone" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_timezone, input ad_mstr.ad_timezone,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_mod_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_mod_date), input string(ad_mstr.ad_mod_date),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_userid, input ad_mstr.ad_userid,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_edi_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_edi_id, input ad_mstr.ad_edi_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_edi_ctrl[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_edi_ctrl[1], input ad_mstr.ad_edi_ctrl[1],
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_conrep" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_conrep, input ad_mstr.ad_conrep,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_barlbl_prt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_barlbl_prt, input ad_mstr.ad_barlbl_prt,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_barlbl_val" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_barlbl_val, input ad_mstr.ad_barlbl_val,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_calendar" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_calendar, input ad_mstr.ad_calendar,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_edi_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_edi_std, input ad_mstr.ad_edi_std,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_edi_level" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_edi_level, input ad_mstr.ad_edi_level,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__qad01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__qad01, input ad_mstr.ad__qad01,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__qad02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__qad02, input ad_mstr.ad__qad02,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__qad03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__qad03, input ad_mstr.ad__qad03,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__qad04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__qad04, input ad_mstr.ad__qad04,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__qad05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__qad05, input ad_mstr.ad__qad05,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__chr01, input ad_mstr.ad__chr01,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__chr02, input ad_mstr.ad__chr02,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__chr03, input ad_mstr.ad__chr03,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__chr04, input ad_mstr.ad__chr04,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad__chr05, input ad_mstr.ad__chr05,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tp_loc_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_tp_loc_code, input ad_mstr.ad_tp_loc_code,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_ctry" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_ctry, input ad_mstr.ad_ctry,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tax_zone" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_tax_zone, input ad_mstr.ad_tax_zone,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tax_usage" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_tax_usage, input ad_mstr.ad_tax_usage,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_misc1_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_misc1_id, input ad_mstr.ad_misc1_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_misc2_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_misc2_id, input ad_mstr.ad_misc2_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_misc3_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_misc3_id, input ad_mstr.ad_misc3_id,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_wk_offset" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_wk_offset), input string(ad_mstr.ad_wk_offset),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_inv_mthd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_inv_mthd, input ad_mstr.ad_inv_mthd,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_sch_mthd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_sch_mthd, input ad_mstr.ad_sch_mthd,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_po_mthd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_po_mthd, input ad_mstr.ad_po_mthd,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_asn_data" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_asn_data, input ad_mstr.ad_asn_data,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_intr_division" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_intr_division, input ad_mstr.ad_intr_division,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_tax_report" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_tax_report), input string(ad_mstr.ad_tax_report),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_name_control" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ad_mstr.ad_name_control, input ad_mstr.ad_name_control,
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "ad_last_file" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ad_mstr.ad_last_file), input string(ad_mstr.ad_last_file),
                    input recid(ad_mstr), input ad_mstr.ad_addr, input "", input "", input "",
                    input "", input "", input "", input "").

        end.

    end.
end.

{hkdttrans.i}
